2022-10-12

Addressing the problem

While new car models come out and discontinued each year, some model remains to be long time seller. For this project, I will dive into identify what characteristic does the top sold car have/what do consumers look for when buying a car.

More information can be found here below. https://www.kaggle.com/datasets/gagandeep16/car-sales

Setting up the necessity

library(plotly)
library(dplyr)
df<- read.csv("Car_sales.csv")
df <- subset(df,select =-Vehicle_type)

Every plot was generated using plotly

Dataset overview

glimpse(df)

## Rows: 157
## Columns: 15
## $ Manufacturer         <chr> "Acura", "Acura", "Acura", "Acura", "Audi", "Audi…
## $ Model                <chr> "Integra", "TL", "CL", "RL", "A4", "A6", "A8", "3…
## $ Sales_in_thousands   <dbl> 16.919, 39.384, 14.114, 8.588, 20.397, 18.780, 1.…
## $ X__year_resale_value <dbl> 16.360, 19.875, 18.225, 29.725, 22.255, 23.555, 3…
## $ Price_in_thousands   <dbl> 21.500, 28.400, NA, 42.000, 23.990, 33.950, 62.00…
## $ Engine_size          <dbl> 1.8, 3.2, 3.2, 3.5, 1.8, 2.8, 4.2, 2.5, 2.8, 2.8,…
## $ Horsepower           <int> 140, 225, 225, 210, 150, 200, 310, 170, 193, 193,…
## $ Wheelbase            <dbl> 101.2, 108.1, 106.9, 114.6, 102.6, 108.7, 113.0, …
## $ Width                <dbl> 67.3, 70.3, 70.6, 71.4, 68.2, 76.1, 74.0, 68.4, 6…
## $ Length               <dbl> 172.4, 192.9, 192.0, 196.6, 178.0, 192.0, 198.2, …
## $ Curb_weight          <dbl> 2.639, 3.517, 3.470, 3.850, 2.998, 3.561, 3.902, …
## $ Fuel_capacity        <dbl> 13.2, 17.2, 17.2, 18.0, 16.4, 18.5, 23.7, 16.6, 1…
## $ Fuel_efficiency      <int> 28, 25, 26, 22, 27, 22, 21, 26, 24, 25, 25, 23, 2…
## $ Latest_Launch        <chr> "2/2/2012", "6/3/2011", "1/4/2012", "3/10/2011", …
## $ Power_perf_factor    <dbl> 58.28015, 91.37078, NA, 91.38978, 62.77764, 84.56…

Dataset overview continued

Ford F-seiries seems to be the favorite by far.(possibly counting every F-series line up )

select(df, Manufacturer, Model, Sales_in_thousands) %>%
  arrange(desc(Sales_in_thousands))
##     Manufacturer          Model Sales_in_thousands
## 1           Ford       F-Series            540.561
## 2           Ford       Explorer            276.747
## 3         Toyota          Camry            247.994
## 4           Ford         Taurus            245.815
## 5          Honda         Accord            230.902
## 6          Dodge     Ram Pickup            227.061
## 7           Ford         Ranger            220.650
## 8          Honda          Civic            199.685
## 9          Dodge        Caravan            181.749
## 10          Ford          Focus            175.670
## 11          Jeep Grand Cherokee            157.040
## 12          Ford       Windstar            155.787
## 13     Chevrolet       Cavalier            145.519
## 14        Toyota        Corolla            142.535
## 15     Chevrolet         Malibu            135.126
## 16       Pontiac       Grand Am            131.097
## 17          Ford     Expedition            125.338
## 18          Ford        Mustang            113.369
## 19         Dodge         Dakota            111.313
## 20     Chevrolet         Impala            107.995
## 21         Dodge        Durango            101.323
## 22       Pontiac     Grand Prix             92.364
## 23         Buick        Century             91.561
## 24        Nissan         Altima             88.094
## 25         Dodge       Intrepid             88.028
## 26        Toyota         Tacoma             84.087
## 27    Volkswagen          Jetta             83.721
## 28         Buick        LeSabre             83.257
## 29       Mercury  Grand Marquis             81.174
## 30        Saturn             SL             80.620
## 31          Jeep       Cherokee             80.556
## 32    Oldsmobile          Alero             80.255
## 33        Nissan         Maxima             79.853
## 34         Dodge           Neon             76.034
## 35         Honda        Odyssey             76.029
## 36         Honda           CR-V             73.203
## 37         Dodge        Stratus             71.186
## 38          Ford         Escort             70.227
## 39        Toyota        4Runner             68.411
## 40       Mercury          Sable             67.956
## 41       Hyundai        Elantra             66.692
## 42        Toyota         Sienna             65.119
## 43        Nissan       Frontier             65.005
## 44        Toyota         Avalon             63.849
## 45      Cadillac        DeVille             63.729
## 46          Ford Crown Victoria             63.403
## 47    Mitsubishi         Galant             55.616
## 48          Jeep       Wrangler             55.557
## 49        Nissan         Xterra             54.158
## 50      Chrysler Town & Country             53.480
## 51       Pontiac        Sunfire             51.645
## 52         Lexus          RX300             51.238
## 53    Volkswagen         Passat             51.102
## 54        Saturn             LS             49.989
## 55    Volkswagen         Beetle             49.463
## 56       Lincoln       Town car             48.911
## 57        Subaru        Outback             47.107
## 58        Nissan         Sentra             42.643
## 59     Chevrolet    Monte Carlo             42.593
## 60        Nissan     Pathfinder             42.574
## 61    Mitsubishi        Eclipse             42.541
## 62       Hyundai         Accent             41.184
## 63       Pontiac        Montana             39.572
## 64         Acura             TL             39.384
## 65         Buick          Regal             39.350
## 66    Mitsubishi  Montero Sport             39.348
## 67    Oldsmobile       Intrigue             38.554
## 68       Pontiac     Bonneville             35.945
## 69          Ford        Contour             35.068
## 70        Toyota         Celica             33.269
## 71        Subaru       Forester             33.028
## 72      Chrysler  Sebring Conv.             32.775
## 73      Plymouth           Neon             32.734
## 74      Chrysler         Cirrus             32.306
## 75     Chevrolet          Prizm             32.299
## 76      Chrysler       Concorde             31.148
## 77         Dodge        Ram Van             31.038
## 78      Chrysler           300M             30.696
## 79       Hyundai         Sonata             29.450
## 80    Mercedes-B        M-Class             28.976
## 81         Buick    Park Avenue             27.851
## 82       Mercury    Mountaineer             27.609
## 83    Mercedes-B        E-Class             27.602
## 84        Nissan          Quest             27.308
## 85       Mercury         Cougar             26.529
## 86     Chevrolet         Camaro             26.402
## 87    Mitsubishi         Mirage             26.232
## 88        Toyota           RAV4             25.106
## 89     Chevrolet         Lumina             24.629
## 90        Saturn             SC             24.546
## 91    Oldsmobile     Silhouette             24.361
## 92      Plymouth        Voyager             24.155
## 93         Lexus          ES300             24.072
## 94      Infiniti            I30             23.713
## 95       Lincoln      Navigator             22.925
## 96     Chevrolet          Metro             21.855
## 97          Audi             A4             20.397
## 98       Mercury       Villager             20.380
## 99    Oldsmobile        Bravada             20.017
## 100      Pontiac       Firebird             19.911
## 101          BMW           323i             19.747
## 102        Volvo            S80             18.969
## 103         Audi             A6             18.780
## 104   Mercedes-B        C-Class             18.392
## 105    Chevrolet       Corvette             17.947
## 106        Volvo            V70             17.531
## 107          BMW           528i             17.527
## 108        Volvo            S40             16.957
## 109        Acura        Integra             16.919
## 110   Mercedes-B        S-Class             16.774
## 111        Dodge      Ram Wagon             16.767
## 112     Cadillac        Seville             15.943
## 113       Jaguar         S-Type             15.467
## 114        Volvo            S70             15.245
## 115     Cadillac       Escalade             14.785
## 116   Oldsmobile         Aurora             14.690
## 117      Mercury       Mystique             14.351
## 118        Acura             CL             14.114
## 119      Lincoln    Continental             13.798
## 120     Chrysler            LHS             13.462
## 121        Honda       Passport             12.855
## 122        Lexus          GS300             12.698
## 123         Saab          3-Sep             12.115
## 124   Mercedes-B      CLK Coupe             11.592
## 125   Mitsubishi        Montero             11.337
## 126     Cadillac         Catera             11.185
## 127       Toyota   Land Cruiser              9.835
## 128   Volkswagen           Golf              9.761
## 129   Volkswagen         Cabrio              9.569
## 130          BMW           328i              9.231
## 131         Saab          5-Sep              9.191
## 132        Lexus          LX470              9.126
## 133      Porsche         Boxter              8.982
## 134        Acura             RL              8.588
## 135       Saturn             LW              8.472
## 136   Mercedes-B            SLK              7.998
## 137     Chrysler  Sebring Coupe              7.854
## 138     Cadillac       Eldorado              6.536
## 139        Lexus          LS400              6.375
## 140   Mitsubishi       Diamante              5.711
## 141   Volkswagen            GTI              5.596
## 142     Plymouth         Breeze              5.240
## 143       Saturn             SW              5.223
## 144        Dodge        Avenger              4.734
## 145        Volvo            V40              3.545
## 146        Volvo            C70              3.493
## 147        Lexus          GS400              3.334
## 148   Mercedes-B       SL-Class              3.311
## 149     Plymouth        Prowler              1.872
## 150      Porsche Carrera Cabrio              1.866
## 151   Mercedes-B         SLK230              1.526
## 152         Audi             A8              1.380
## 153      Porsche  Carrera Coupe              1.280
## 154   Oldsmobile        Cutlass              1.112
## 155   Mercedes-B          CL500              0.954
## 156        Dodge          Viper              0.916
## 157   Mitsubishi         3000GT              0.110

First assumption Horsepower

Assumption: horsepower

fig4 <- plot_ly(df, 
                x = ~Horsepower,
                y = ~Sales_in_thousands,
                type='scatter',
                mode = 'markers',
                hoverinfo = 'text',
                text = paste('Horsepower: ', df$Horsepower,
                             "<br>",
                             'Sales in thousands: ', df$Sales_in_thousands,
                             "<br>",
                             "Manufacture: ", df$Manufacturer,
                             "<br>",
                             "Model:", df$Model),
                color = ~Manufacturer,
                marker= list(size =10))
fig4 <- fig4 %>% layout(
                        yaxis = list(zeroline = FALSE),
                        xaxis = list(zeroline = FALSE))

Result: Not everyone like the horsepower

Comparing the usual suspects

Another thing come to mind is usually car’s horsepower and fuel economy.

fig3 <- plot_ly(df, 
                x = ~Fuel_efficiency, 
                y = ~ Horsepower,
                type = 'scatter',
text = paste('Horsepower: ', df$Horsepower,
                             "<br>",
                             'Fuel Efficiency', df$Fuel_efficiency,
                             "<br>",
                             'Sales in thousands: ', df$Sales_in_thousands,
                             "<br>",
                             "Manufacture: ", df$Manufacturer,
                             "<br>",
                             "Model:", df$Model),
                mode = 'markers',
                color = ~Sales_in_thousands )
fig3 <- fig3 %>% layout(title = 'Horsepower vs Fuel Efficiency',
                   xaxis = list(showgrid = FALSE),
                   yaxis = list(showgrid = FALSE))

Fuel efficiency seems to be the favour.

Diving in deeper, 3D plotting

Customer prefers inexpensive, fuel friendly car instead of beefy expensive car. Quite obvious to see the pllots are more concentrated on fuel friendly cars.

fig5 <- plot_ly(df, x = ~Horsepower, y = ~Price_in_thousands, z = ~Fuel_efficiency,
                type ='scatter3d',
                mode = 'markers',
                hoverinfo = 'text',
                color =~Sales_in_thousands,
                text = paste("Cars sold in thousdands: ", df$Sales_in_thousands,
                             "<br>",
                             "Manufacture: ", df$Manufacturer,
                             "<br>",
                             "Model:", df$Model))
fig5 <- fig5 %>% add_markers()

Omitting the Ford F-Seires to see the better understanding of where other car model stand.

df=df[-57,]

Deepdive continue

Here, rather than looking at the total car sold, I have made a column of revenue for better understanding.Horsepower and fuel efficiency relationship is inverse proportion regardless.

df$revenue <-with(df, Sales_in_thousands * Price_in_thousands)

Conclusion

By plotting the given data, I was able to solve what customers are looking for when shopping for cars.At first, horsepower could be one of a good factor. However, that’s not the case, customers are looking for inexpensive and fuel friendly car like what I would pick.Ford F-Series being top could be the data is counting all of the F-Series line up(F-150, F-250 etc)